const http = require('http');
const url = require('url');
const config = require('./config.js')
const sd = require('silly-datetime')  //日期时间格式转换模块
const md5 = require('md5-nodejs')       //md5加密模块
const fs =require('fs')



http.createServer(function(req,res){

                                    //第二个值为true将返回的数据转换为一个对象
    var params  = url.parse(req.url,true);
    if(params.pathname == '/a'){

        console.log(params.query.name)
        res.writeHead(200,{"Content-Type":"text/html;charset='utf-8'"});
   
   
        res.write('你的参数是:'+params.search);

        console.log(config.config);
        console.log(config.tools)
        var time = new Date();
        console.log(sd.format(time,'YYYY-MM-DD HH:mm'))

        let hash = md5('988yy9564');
        console.log(hash)

        
    }
   

    res.end();

}).listen(8080);


// var info = url.parse('http://www.baidu.com/a?name=123');
// var tempurl = url.resolve('http://www.baidu.com/','news');
// console.log(tempurl);
// console.log(info);


//7课